package com.example.blog.module.controller;


import com.example.blog.module.entity.VO.Result;
import com.example.blog.module.service.ArticleLikeService;
import com.example.blog.module.service.CommentLikeService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

/**
 * @author 郑家莽
 */
@RestController
@RequiredArgsConstructor
@RequestMapping("/like")
public class LikeController {

    private final ArticleLikeService articleLikeService;

    private final CommentLikeService commentLikeService;

    @GetMapping("article/{id}")
    public Result articleLike(@PathVariable("id") String articleId){
        articleLikeService.like("article", Long.valueOf(articleId));
        return Result.success(null);
    }

    @GetMapping("comment/{id}")
    public Result commentLike(@PathVariable("id") String commentId){
        commentLikeService.like("comment", Long.valueOf(commentId));
        return Result.success(null);
    }
}
